package org.hi.trip.model.original;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date;
import java.util.List;

import org.hi.framework.model.BaseObject;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import org.hi.tripmodel.model.TripModel;
import org.hi.trip.model.TripPrice;
import org.hi.trip.model.Trip;
import org.hi.trip.model.SpecialPrice;
import org.hi.base.organization.model.HiUser;

public abstract class TripAbstract extends BaseObject implements Serializable{

 	
 	/**
	 * 锟斤拷锟斤拷id
	 */	
	protected  Integer id;

	/**
	 * 锟芥本锟斤拷锟斤拷version
	 */	
 	protected  Integer version;

 	 /**
	 * 锟斤拷路id
	 */	
 	protected  TripModel trip_model;

 	 /**
	 * 锟斤拷路锟斤拷锟�
	 */	
 	protected  TripModel trip_model_code;

 	 /**
	 * 锟斤拷锟�
	 */	
 	protected  Double price;

 	 /**
	 * 锟睫讹拷
	 */	
 	protected  Integer seats_available;

 	 /**
	 * 锟斤拷锟斤拷锟斤拷锟斤拷
	 */	
 	protected  Date trip_date;

 	 /**
	 * 锟斤拷伪锟斤拷
	 */	
 	protected  String trip_code;

 	 /**
	 * 锟斤拷锟斤拷劭锟�
	 */	
 	protected  Double discount = 1d;

 	 /**
	 * 锟桔扣匡拷始锟斤拷锟斤拷
	 */	
 	protected  Date discount_startDate = new java.util.Date();

 	 /**
	 * 锟桔扣斤拷锟斤拷时锟斤拷
	 */	
 	protected  Date discount_endDate;

 	 /**
	 * 锟斤拷锟斤拷锟斤拷
	 */	
 	protected  HiUser creator = org.hi.framework.security.context.UserContextHelper.getUser();

 	 /**
	 * 删锟斤拷锟绞�
	 */	
 	protected  Integer deleted = 0;

	private  List<TripPrice> tripPrices;
	private  List<SpecialPrice> specialPrices;
	
	/**
	 * 折扣价
	 * @return
	 */
	public abstract double getDiscountPrice();
	
	/**
	 * 同行销售价
	 * @return
	 */
	public abstract double getPartnerPrice();
	
	/**
	 * 同行成团销售价
	 * @return
	 */
	public abstract double getPartnerGroupPrice();
	
	/**
	 * 同行前台销售价
	 * @return
	 */
	public abstract double getPartnerNetworkPrice();
	
	/**
	 * 同行前台成团销售价
	 * @return
	 */
	public abstract double getPartnerNetworkGroupPrice();
	
	/**
	 * 直客销售价
	 * @return
	 */
	public abstract double getCustomerPrice();
	
	/**
	 * 直客成团销售价
	 * @return
	 */
	public abstract double getCustomerGroupPrice();
	
	/**
	 * 直客前台销售价
	 * @return
	 */
	public abstract double getCustomerNetworkPrice();
	
	/**
	 * 直客前台成团销售价
	 * @return
	 */
	public abstract double getCustomerNetworkGroupPrice();
	
	/**
	 * 同行成团标准
	 * @return
	 */
	public abstract int getPartnerGroupNumber();
	
	/**
	 * 散客成团标准
	 * @return
	 */
	public abstract int getCustomerGroupNumber();

    public Integer getId() {
        return this.id;
    }
    
    public void setId(Integer id) {
    		if((id != null && this.id == null) || 
				this.id != null && (!this.id.equals(id) || id == null)){
        		this.setDirty(true);
        		this.oldValues.put("id", this.id);
        	}
        this.id = id;
    }
    
     public Integer getVersion() {
        return this.version;
    }
    
    public void setVersion(Integer version) {
    		if((version != null && this.version == null) || 
				this.version != null && (!this.version.equals(version) || version == null)){
        		this.setDirty(true);
        		this.oldValues.put("version", this.version);
        	}
        this.version = version;
    }
    
    public TripModel getTrip_model() {
        return this.trip_model;
    }
    
    public void setTrip_model(TripModel trip_model) {
    		if((trip_model != null && this.trip_model == null) || 
				this.trip_model != null && (!this.trip_model.equals(trip_model) || trip_model == null)){
        		this.setDirty(true);
        		this.oldValues.put("trip_model", this.trip_model);
        	}
        this.trip_model = trip_model;
    }
    
    public TripModel getTrip_model_code() {
        return this.trip_model_code;
    }
    
    public void setTrip_model_code(TripModel trip_model_code) {
    		if((trip_model_code != null && this.trip_model_code == null) || 
				this.trip_model_code != null && (!this.trip_model_code.equals(trip_model_code) || trip_model_code == null)){
        		this.setDirty(true);
        		this.oldValues.put("trip_model_code", this.trip_model_code);
        	}
        this.trip_model_code = trip_model_code;
    }
    
    public Double getPrice() {
        return this.price;
    }
    
    public void setPrice(Double price) {
    		if((price != null && this.price == null) || 
				this.price != null && (!this.price.equals(price) || price == null)){
        		this.setDirty(true);
        		this.oldValues.put("price", this.price);
        	}
        this.price = price;
    }
    
    public Integer getSeats_available() {
        return this.seats_available;
    }
    
    public void setSeats_available(Integer seats_available) {
    		if((seats_available != null && this.seats_available == null) || 
				this.seats_available != null && (!this.seats_available.equals(seats_available) || seats_available == null)){
        		this.setDirty(true);
        		this.oldValues.put("seats_available", this.seats_available);
        	}
        this.seats_available = seats_available;
    }
    
    public Date getTrip_date() {
        return this.trip_date;
    }
    
    public void setTrip_date(Date trip_date) {
    		if((trip_date != null && this.trip_date == null) || 
				this.trip_date != null && (!this.trip_date.equals(trip_date) || trip_date == null)){
        		this.setDirty(true);
        		this.oldValues.put("trip_date", this.trip_date);
        	}
        this.trip_date = trip_date;
    }
    
    public String getTrip_code() {
        return this.trip_code;
    }
    
    public void setTrip_code(String trip_code) {
    		if((trip_code != null && this.trip_code == null) || 
				this.trip_code != null && (!this.trip_code.equals(trip_code) || trip_code == null)){
        		this.setDirty(true);
        		this.oldValues.put("trip_code", this.trip_code);
        	}
        this.trip_code = trip_code;
    }
    
    public Double getDiscount() {
        return this.discount;
    }
    
    public void setDiscount(Double discount) {
    		if((discount != null && this.discount == null) || 
				this.discount != null && (!this.discount.equals(discount) || discount == null)){
        		this.setDirty(true);
        		this.oldValues.put("discount", this.discount);
        	}
        this.discount = discount;
    }
    
    public Date getDiscount_startDate() {
        return this.discount_startDate;
    }
    
    public void setDiscount_startDate(Date discount_startDate) {
    		if((discount_startDate != null && this.discount_startDate == null) || 
				this.discount_startDate != null && (!this.discount_startDate.equals(discount_startDate) || discount_startDate == null)){
        		this.setDirty(true);
        		this.oldValues.put("discount_startDate", this.discount_startDate);
        	}
        this.discount_startDate = discount_startDate;
    }
    
    public Date getDiscount_endDate() {
        return this.discount_endDate;
    }
    
    public void setDiscount_endDate(Date discount_endDate) {
    		if((discount_endDate != null && this.discount_endDate == null) || 
				this.discount_endDate != null && (!this.discount_endDate.equals(discount_endDate) || discount_endDate == null)){
        		this.setDirty(true);
        		this.oldValues.put("discount_endDate", this.discount_endDate);
        	}
        this.discount_endDate = discount_endDate;
    }
    
    public HiUser getCreator() {
        return this.creator;
    }
    
    public void setCreator(HiUser creator) {
    		if((creator != null && this.creator == null) || 
				this.creator != null && (!this.creator.equals(creator) || creator == null)){
        		this.setDirty(true);
        		this.oldValues.put("creator", this.creator);
        	}
        this.creator = creator;
    }
    
    public Integer getDeleted() {
        return this.deleted;
    }
    
    public void setDeleted(Integer deleted) {
    		if((deleted != null && this.deleted == null) || 
				this.deleted != null && (!this.deleted.equals(deleted) || deleted == null)){
        		this.setDirty(true);
        		this.oldValues.put("deleted", this.deleted);
        	}
        this.deleted = deleted;
    }
    

    public void setTripPrices(List<TripPrice> tripPrices) {
        this.tripPrices = tripPrices;
    }

    public List<TripPrice> getTripPrices() {
        return this.tripPrices;
    }
    public void setSpecialPrices(List<SpecialPrice> specialPrices) {
        this.specialPrices = specialPrices;
    }

    public List<SpecialPrice> getSpecialPrices() {
        return this.specialPrices;
    }

   public boolean equals(Object other) {
         if ( (this == other ) ) return true;
		 if ( (other == null ) ) return false;
		 if ( !(other instanceof Trip) ) return false;
		 Trip castOther = ( Trip ) other; 
		 
		 return  ( (this.getId()==castOther.getId()) || ( this.getId()!=null && castOther.getId()!=null && this.getId().equals(castOther.getId()) ) );
   }
   
   public int hashCode() {
        HashCodeBuilder hcb = new HashCodeBuilder(17, 37);
        hcb.append(getId());
		hcb.append("Trip".hashCode());
        return hcb.toHashCode();
    }

   public String toString() {
       ToStringBuilder sb = new ToStringBuilder(this, ToStringStyle.DEFAULT_STYLE);
       sb.append("id", this.id)
		.append("price", this.price)
		.append("seats_available", this.seats_available)
		.append("trip_code", this.trip_code)
		.append("discount", this.discount)
		.append("deleted", this.deleted);
      
        return sb.toString();
   }

   public Serializable getPrimarykey(){
   		return id;
   }



}